This application is based upon and claims the benefit of priority from the prior Japanese Patent Application No. 11-353176, filed Dec. 13, 1999; and No. 2000-271686, filed Sep. 7, 2000, the entire contents of which are incorporated herein by reference.
The present invention relates to a portable electronic device, such as an IC (smart) card, which has a nonvolatile memory for storing data and reads from and writes into the memory for the transfer of data to and from outside.
Recently, IC cards have begun to be used in various fields of industry which have an on-board IC chip having a nonvolatile memory and a control device such as a CPU (central processing unit).
In general, the IC cards of this type are arranged to make data transfers to and from an external device (IC card reader/writer) using commands and responses.
Such IC cards do not usually have a self-diagnostic function built in, which performs a self-diagnosis of whether they work properly. In recent years, however, IC cards having a built-in self-diagnostic function have been developed.
An IC card with a built-in self-diagnostic function that is disclosed in U.S. Pat. No. 4,939,353 is arranged to perform all diagnoses prior to the start of transfer of initial response data to an external device after the card was activated.
However, since the interval between the moment that the card is activated (resetting cancellation) and the moment that the initial response data is outputted is set by standards to 400 to 40,000 clock periods, errors might occur if the interval were in excess of the settings. Thus, only limited diagnoses are allowed within this short interval, failing to perform sufficient self-diagnosis.
Further, Jpn. Pat. Appln. KOKAI publication No. 63-234375 might suggest performing a diagnosis after the first cycle of initial response data (after 1 byte output) before next cycle of initial response data (next 1 byte output). However, this would impose restrictions on the signal format of the initial response data, requiring a long time to transfer the initial response data. In that event, the external device would thus judge that a time-out error had occurred in the initial response data.
When the IC card fails to perform the self-diagnosis, for example, when an LSI within the IC card has been damaged by an external shock, malfunctions may occur upon entry of commands from the external device, resulting in loss of the reliability of the IC card.
It is an object of the present invention a portable electronic device which permits a self-diagnosis to be performed even if a command is received at any time after initial response data has been output, the self-diagnosis to be performed during an idle time (command waiting time) within processing time, and the total processing time from the beginning to the end of session to be utilized in an efficient manner, and malfunctions to be prevented.
According to the present invention, there is provided a portable data processing device comprising: initial response transmit means for, in response to the portable data processing device being connected to and activated by an external device, transmitting initial response data to the external device; self-diagnosis means for performing a self-diagnosis of whether the portable data processing device operates properly after the initial response transmit means has transmitted the initial response data to the external device; and command processing means for receiving a command from the external device and performing corresponding processing to the received command after the self-diagnosis has been performed by the self-diagnosis means.
The portable electronic device of the present invention, when connected to and activated by the external device, transmits all the initial response data to the external device. After that, a self-diagnosis is performed to ensure that the portable electronic device operates properly. Unlike the prior art in which self-diagnosis is performed within a short interval when initial response data is transmitted, in the present invention, since no restriction is imposed on the self-diagnosis processing time, a sufficient time can be taken for self-diagnosis of many items. Since there is no need to perform the self-diagnosis at the same time the initial response data is transmitted, no restriction is imposed on the signal format of the initial response data, which prevents the occurrence of communication errors due to failure to take the optimum signal format. Therefore, a portable data processing device can be provided which permits compatibility of communication with the external device and self-diagnosis.
In addition, in the present invention, an embodiment is disclosed which, upon receipt of a command from the external device during self-diagnosis, suspends the self-diagnosis and then resumes it after the reception of the command. This embodiment will also provide a portable data processing device which permits compatibility of communication with the external device and self-diagnosis with high reliability.
Additional objects and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objects and advantages of the invention may be realized and obtained by means of the instrumentalities and combinations particularly pointed out hereinafter.